{{ content() }}

<div class="page-content-area">
    <div class="page-header">
        <h1>
            Video Category
        </h1>
        <div class="text-right">
            {{ link_to(config.application.backendUrl ~ "/video/create" , "<i class='ace-icon glyphicon glyphicon-plus bigger-120'></i> Them video", "class": "btn btn-xs btn-primary") }}
        </div>
    </div>

    <div class="widget-box form-filter">
        <div class="widget-header widget-header-small">
            <h5 class="widget-title lighter">Tìm video</h5>
        </div>

        <div class="widget-body">
            <div class="widget-main">
                {{ form(formSearchVideo.getAction() , 'class': 'form-inline' , 'method' : 'GET') }}
                <div class="form-group">
                    <div class="col-md-11">
                        <div class="form-group">
                            <div class="col-md-1 col-md-3 padding-left-none">
                                {{ text_field('id' , 'class' :'forms-control col-xs-12' , 'placeholder' : 'id') }}
                            </div>
                            <div class="col-md-3">
                                {{ formSearchVideo.render('name' , ['placeholder' : 'Tên file video']) }}
                            </div>
                            <div class="col-md-3">
                                {{ formSearchVideo.render('category_id') }}
                            </div>
                            <div class="col-md-3">
                                {{ formSearchVideo.render('national_id') }}
                            </div>
                            <div class="col-md-2">
                                {{ formSearchVideo.render('status') }}
                            </div>
                        </div>
                    </div>
                    <div class="col-md-1">
                        <button type="submit" class="btn btn-xs btn-primary btnSeachVideo" ng-click="searchVideoFile()" style="height: 30px;">Tìm</button>
                        {# link_to(config.application.backendUrl ~ "/video" , "Reset", "class": "btn btn-xs btn-default") #}
                    </div>
                    <div style="clear: both;"></div>
                </div>
                {{ end_form() }}
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-xs-12">
            <div class="row">
                <div class="col-xs-12">
                    <div class="dataTables_wrapper form-inline no-footer">
                        <div class="row">
                            <div class="col-xs-12">
                                <div class="text-right">
                                    {% if pager.haveToPaginate() %}
                                        {# Render the navigation #}
                                        {{ pager.getLayout() }}
                                    {% endif %}
                                </div>
                            </div>
                        </div>
                        <table class="table table-striped table-bordered table-hover dataTable no-footer">
                            <thead>
                            <tr>
                                <th class="center">
                                    <div class="inline position-relative w40">
                                        <label class="inline middle">
                                            <input type="checkbox" class="ace checkSelectVideoAll">
                                            <span class="lbl"></span>
                                        </label>
                                        <div class="inline position-relative form-group">
                                            <a href="#" data-toggle="dropdown" class="dropdown-toggle">
                                                <i class="ace-icon fa fa-caret-down bigger-125 middle"></i>
                                            </a>

                                            <ul class="dropdown-menu dropdown-lighter dropdown-100">
                                                <li>
                                                    <a id="id-select-message-all" href="#">Hoạt động</a>
                                                </li>

                                                <li>
                                                    <a id="id-select-message-none" href="#">Vô hiệu hóa</a>
                                                </li>
                                                <li>
                                                    <a id="id-select-message-none" href="#">Ẩn</a>
                                                </li>                                       
                                            </ul>
                                        </div>
                                    </div>
                                </th>
                                <th>Id</th>
                                <th>Hinh ảnh</th>
                                <th>Tên phim</th>
                                <th>Thể loại</th>
                                <th>Quốc gia</th>
                                <th>Diễn viên</th>
                                <th>Trạng thái</th>
                                <th>Hành động</th>
                            </tr>
                            </thead>
                            <tbody>
                                {% for video in pager %}
                                <tr>
                                    <td class="center">
                                        <label class="position-relative">
                                            <input type="checkbox" class="ace selectVideo" name="selectVideo[]" value="{{ video.getId() }}">
                                            <span class="lbl"></span>
                                        </label>
                                    </td>
                                    <td>{{ video.getId() }} </td>
                                    <td>
                                        {{ image(helper.getPathImageFromImageLink(video.getMainImages() , '220_124') , 'width' : 210 , 'height': '124') }}
                                    </td>
                                    <td>
                                        {{ link_to(config.application.backendUrl ~ "/video/edit/" ~ video.getId() , video.videoDescription.getName() ) }}
                                    </td>
                                    <td>
                                        {% if(video.videoCategoryLink) %}
                                            {% for videoCategoryLink in video.videoCategoryLink %}
                                                {{ videoCategoryLink.category.getName() ~ ' , ' }}
                                            {% endfor %}
                                        {% endif %}
                                    </td>
                                    <td>
                                        {% if(video.videoDescription.national) %}
                                        {# video.videoDescription.national.getName() #}
                                        {% endif %}
                                    </td>
                                    <td>

                                    </td>
                                    <td>
                                        <div class="hidden-sm hidden-xs">
                                            <div class="inline position-relative">
                                                <button class="btn btn-minier btn-primary" data-toggle="dropdown" data-position="auto">
                                                    {{ helper.getStatus(video.getStatus()) }}
                                                    <i class="ace-icon fa fa-angle-down bigger-110"></i>
                                                </button>

                                                <ul class="dropdown-menu dropdown-only-icon dropdown-menu-right dropdown-caret dropdown-close">
                                                    <li>
                                                        {{ link_to(config.application.backendUrl ~ "/video/updateStatus?video_id=" ~ video.getId() ~ "&status=A" , "Hoạt động", "class": "") }}
                                                    </li>

                                                    <li>
                                                        {{ link_to(config.application.backendUrl ~ "/video/updateStatus?video_id=" ~ video.getId() ~ "&status=D" , "Vô hiệu hóa", "class": "") }}

                                                    </li>

                                                    <li>
                                                        {{ link_to(config.application.backendUrl ~ "/video/updateStatus?video_id=" ~ video.getId() ~ "&status=H", "Ẩn", "class": "") }}
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="hidden-sm hidden-xs btn-group">
                                            {{ link_to(config.application.backendUrl ~ "/video/edit/" ~ video.getId() , "<i class='ace-icon fa fa-pencil bigger-120'></i>", "class": "btn btn-xs btn-info tooltip-success") }}
                                            {{ link_to(config.application.backendUrl ~ "/video/delete/" ~ video.getId(), "<i class='ace-icon fa fa-trash-o bigger-120'></i>", "class": "btn btn-xs btn-danger tooltip-success" , "onclick" : "if(!confirm('Bạn có chắc xóa không?')){return false;};") }}
                                        </div>
                                    </td>
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                        <div class="row">
                            <div class="col-xs-6">
                                <div class="dataTables_info" id="sample-table-2_info" role="status" aria-live="polite">

                                </div>
                            </div>
                            <div class="col-xs-6">
                                <div class="dataTables_paginate paging_simple_numbers" id="sample-table-2_paginate">
                                    {% if pager.haveToPaginate() %}
                                        {# Render the navigation #}
                                        {{ pager.getLayout() }}
                                    {% endif %}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
